package collection.homework.Collection;

import java.util.ArrayList;
import java.util.Collection;

/**
 * add()
 * size()
 * isEmpty()
 * clear()
 */
public class CollectionDemo1 {
    public static void main(String[] args) {
        Collection a = new ArrayList();
        a.add("one");
        a.add("two");
        a.add("three");
        System.out.println("元素个数size为：" + a.size());
        boolean b1 = a.add("four");
        System.out.println(b1);//true
        System.out.println(a);//[one, two, three, four]
        System.out.println("元素个数size为：" + a.size());
        boolean c1 = a.isEmpty();
        System.out.println("是否为空集：" + c1);
        a.clear();//清空集合
        boolean c2 = a.isEmpty();
        System.out.println("是否为空集：" + c2);
    }
}
